package com.hanter.android.radlib.memo;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 类名：PageMemento <br/>
 * 描述：PageStatus -备份
 * 创建时间：2016/09/02 13:24
 */
public class PageMemento implements Parcelable {
    private boolean pullDown;
    private int position;

    public PageMemento(boolean pullDown, int position) {
        this.pullDown = pullDown;
        this.position = position;
    }

    public boolean isPullDown() {
        return pullDown;
    }

    public void setPullDown(boolean pullDown) {
        this.pullDown = pullDown;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte(this.pullDown ? (byte) 1 : (byte) 0);
        dest.writeInt(this.position);
    }

    protected PageMemento(Parcel in) {
        this.pullDown = in.readByte() != 0;
        this.position = in.readInt();
    }

    public static final Parcelable.Creator<PageMemento> CREATOR = new Parcelable.Creator<PageMemento>() {
        @Override
        public PageMemento createFromParcel(Parcel source) {
            return new PageMemento(source);
        }

        @Override
        public PageMemento[] newArray(int size) {
            return new PageMemento[size];
        }
    };
}
